package com.gzcc.utils;

import java.io.File;
import java.io.FileOutputStream;

/**
 * @Description: 文件工具类
 * @Author: Mr.Zhong
 * @Date: 2018/6/13
 */
public class FileUtil {
    /**
     * @Description: 文件上传
     * @Param: file 文件字节数组， filePath  文件路径 ，fileName 文件名
     * @Author: Mr.Zhong
     * @Date: 2018/6/13
     */
    public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception {
        File targetFile = new File(filePath);
        if (!targetFile.exists()) {
            targetFile.mkdirs();
        }
        FileOutputStream out = new FileOutputStream(filePath + fileName);
        out.write(file);
        out.flush();
        out.close();
    }
}
